package com.jy.rhin.support.feign.dto;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jy.rhin.sdk.dto.notification.resp.PublishMessageDto;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Description:
 * @Author: lww
 * @Date: 2022/7/28 10:16
 */
@Data
@NoArgsConstructor
public class NotifyMessageDto {

    public NotifyMessageDto(PublishMessageDto publishMessage) {
        this.subscriptionReference = publishMessage.getSubscribeUid();
        this.topic = publishMessage.getTopicExp();
        this.producerReference = publishMessage.getAddressUrl();
        this.message = JSON.parseObject(publishMessage.getMessage());

    }

    /**
     * 订阅标识号
     */
    private String subscriptionReference;

    /**
     * 通知主题表达式
     */
    private String topic;

    /**
     * 发布通知系统的地址
     */
    private String producerReference;

    /**
     * 消息内容
     */
    private JSONObject message;

}
